<!DOCTYPE html>
<html lang="zh-cn">
   <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title>{$CONF['mallTitle']}后台管理中心</title>
      <link href="__PUBLIC__/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
      <link href="__CSS__/AdminLTE.css" rel="stylesheet" type="text/css" />
      <script src="__PUBLIC__/js/jquery.min.js"></script>
      <script src="__PUBLIC__/plugins/bootstrap/js/bootstrap.min.js"></script>
      <script src="__PUBLIC__/js/common.js"></script>
      <script src="__PUBLIC__/plugins/plugins/plugins.js"></script>
   </head>
   <script>
       function editCateName(id){
         var params = {};
         params.cateName = $('#cateName_'+id).val();
         params.id = id;
         Plugins.waitTips({title:'信息提示',content:'正在提交数据，请稍后...'});
         $.post("{:U('Admin/Help/editCateName')}",params,function(data,textStatus){
          var json = WST.toJson(data);
          if(json.status=='1'){
            Plugins.setWaitTipsMsg({ content:'操作成功',timeout:1000,callback:function(){
               location.reload();
            }});
          }else if(json.statu = -2){
            Plugins.closeWindow();
            Plugins.Tips({title:'信息提示',icon:'error',content:'请填写分类名称!',timeout:1000});
          }else{
            Plugins.closeWindow();
            Plugins.Tips({title:'信息提示',icon:'error',content:'操作失败!',timeout:1000});
          }
         });
       }
       function editCateSort(id){
         var params = {};
         params.cateSort = $('#cateSort_'+id).val();
         params.id = id;
         Plugins.waitTips({title:'信息提示',content:'正在提交数据，请稍后...'});
         $.post("{:U('Admin/Help/editCateSort')}",params,function(data,textStatus){
          var json = WST.toJson(data);
          if(json.status=='1'){
            Plugins.setWaitTipsMsg({ content:'操作成功',timeout:1000,callback:function(){
               location.reload(true);
            }});
          }else{
            Plugins.closeWindow();
            Plugins.Tips({title:'信息提示',icon:'error',content:'操作失败!',timeout:1000});
          }
         });
       }
       function del(id){
            Plugins.confirm({title:'信息提示',content:'您确定要删除该微帮类型吗?',okText:'确定',cancelText:'取消',okFun:function(){
            Plugins.closeWindow();
            Plugins.waitTips({title:'信息提示',content:'正在操作，请稍后...'});
            $.post("{:U('Admin/Help/del')}",{id:id},function(data,textStatus){
                var json = WST.toJson(data);
                if(json.status=='1'){
                    Plugins.setWaitTipsMsg({content:'操作成功',timeout:1000,callback:function(){
                        location.reload();
                    }});
                }else{
                    Plugins.closeWindow();
                    parent.showMsg({msg:'操作失败!',status:'danger'});
                }
            });
        }});
       }
   </script>
   <body class='wst-page'>
       <div class='wst-tbar' style='text-align:right;height:25px;'>
       <a class="btn btn-success glyphicon glyphicon-plus" href="{:U('Admin/Help/toEdit')}" style='float:right'>新增</a>
       </div>
       <div class="wst-body"> 
        <table class="table table-hover table-striped table-bordered wst-list">
           <thead>
             <tr>
               <th>微帮类型名称</th>
               <th>排序号</th>
               <th>操作</th>
             </tr>
           </thead>
           <tbody id="list">
             <volist name="Page['root']" id="io">
               <tr id="{$io.cid}" class="tr" >
                 <td>
                  <input  value="{$io.cateName}" id="cateName_{$io.id}" type="text" placeholder="请填写分类名称" onchange="javascript:editCateName({$io['id']})"  style="width:80%;"  />
                </td>
                 <td>
                  <input value="{$io.cateSort}" id="cateSort_{$io.id}"   type="text" onchange="javascript:editCateSort({$io['id']})"   style="width:50px; " />
                </td>
                 <td><span  class= "btn btn-danger cur delCate td_id" onclick="javascript:del({$io['id']})">删除</span></td>
               </tr>
             </volist>
           </tbody>
        </table>
   </body>
</html>